import CertParse from "@fidm/x509";
import fs from "node:fs";
import path from "node:path";
import type { PrivateKey, Certificate as CertificateType } from "@fidm/x509";
class Certificate {
    // 私钥key
    private: PrivateKey;
    // 公钥序列
    public: CertificateType;
    constructor() {
        let privatePath = path.resolve(__dirname, "../", "src", "resource", "apiclient_key.pem");
        this.private = CertParse.PrivateKey.fromPEM(fs.readFileSync(privatePath));
        let publicPath = path.resolve(__dirname, "../", "src", "resource", "apiclient_cert.pem");
        this.public = CertParse.Certificate.fromPEM(fs.readFileSync(publicPath));
    }
}

export { Certificate };
